package com.fred.colorpicker

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.TextView
import com.fred.colorpicker.listener.ColorPickerListener

class MainActivity : AppCompatActivity() {

    private val colorWheelView by lazy {
        findViewById<ColorWheelView>(R.id.activity_main_color)
    }

    private val barView by lazy {
        findViewById<GraySeekBar>(R.id.activity_main_seek)
    }

    private val picker by lazy {
        findViewById<ColorPickerView>(R.id.activity_main_picker)
    }

    private val test by lazy {
        findViewById<TextView>(R.id.activity_main_test)
    }

    private val test1 by lazy {
        findViewById<TextView>(R.id.activity_main_test1)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
//        val selector = RingColorWheelSelector(this)
//        colorWheelView.setSelector(selector)
//        colorWheelView.selectorColorListener = object : SelectorColorListener {
//            override fun onSelectorColor(color: Int, saturation: Float, brightness: Float) {
//                test.setBackgroundColor(color)
//                barView.setColor(color,saturation, brightness)
//            }
//        }
//        barView.setSelector(selector)
//        barView.selectorColorListener = object :GrayColorListener{
//            override fun onSelectorColor(color: Int) {
//                test1.setBackgroundColor(color)
//            }
//        }
        picker.listener = object :ColorPickerListener{
            override fun onOneColorChange(color: Int) {
                test.setBackgroundColor(color)
            }

            override fun onTwoColorChange(color: Int) {
                test1.setBackgroundColor(color)
            }
        }
    }
}